﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Camc.Quality.Migrations
{
    public partial class add_jinming : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "OId",
                table: "InstructionEntities",
                newName: "OriginalId");

            migrationBuilder.AddColumn<string>(
                name: "TestProjectNum",
                table: "FormRelationEntities",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "InstructionEntityId",
                table: "FormInstructionRelations",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<Guid>(
                name: "RProcessesEntityId",
                table: "FormInstructionRelations",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<string>(
                name: "RProcessesEntityName",
                table: "FormInstructionRelations",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "RTechniqueEntityId",
                table: "FormInstructionRelations",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<string>(
                name: "RTechniqueName",
                table: "FormInstructionRelations",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "RTechniqueNum",
                table: "FormInstructionRelations",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "RWorkStepEntityId",
                table: "FormInstructionRelations",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<string>(
                name: "RWorkStepEntityName",
                table: "FormInstructionRelations",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "ColTitle",
                table: "FormColRelationEntities",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "TechniqueFormColTitle",
                table: "FormColRelationEntities",
                nullable: true);

            migrationBuilder.CreateTable(
                name: "DingLiangAndMultiMediaExaminationFormEntity",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    FormInfoId = table.Column<Guid>(nullable: false),
                    OrderNo = table.Column<int>(nullable: false),
                    Oid = table.Column<string>(nullable: true),
                    PartDrawNo = table.Column<string>(nullable: true),
                    PartName = table.Column<string>(nullable: true),
                    ParamCode = table.Column<string>(nullable: true),
                    ProductNumber = table.Column<string>(nullable: true),
                    InspectionItems = table.Column<string>(nullable: true),
                    InspectionItemsNum = table.Column<string>(nullable: true),
                    DesignRequireValue = table.Column<string>(nullable: true),
                    UpperDeviation = table.Column<string>(nullable: true),
                    LowerDeviation = table.Column<string>(nullable: true),
                    Unit = table.Column<string>(nullable: true),
                    MeasuredValue = table.Column<string>(nullable: true),
                    MediaRecordingTime = table.Column<DateTime>(nullable: true),
                    MediaFileName = table.Column<string>(nullable: true),
                    Operator = table.Column<string>(nullable: true),
                    OperationDate = table.Column<DateTime>(nullable: true),
                    MutualInspector = table.Column<string>(nullable: true),
                    MutualInspectionDate = table.Column<DateTime>(nullable: true),
                    Inspector = table.Column<string>(nullable: true),
                    InspectDate = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DingLiangAndMultiMediaExaminationFormEntity", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "DingLiangExaminationFormEntity",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    FormInfoId = table.Column<Guid>(nullable: false),
                    OrderNo = table.Column<int>(nullable: false),
                    Oid = table.Column<string>(nullable: true),
                    PartDrawNo = table.Column<string>(nullable: true),
                    PartName = table.Column<string>(nullable: true),
                    ParamCode = table.Column<string>(nullable: true),
                    ProductNumber = table.Column<string>(nullable: true),
                    InspectionItems = table.Column<string>(nullable: true),
                    InspectionItemsNum = table.Column<string>(nullable: true),
                    DesignRequireValue = table.Column<string>(nullable: true),
                    UpperDeviation = table.Column<string>(nullable: true),
                    LowerDeviation = table.Column<string>(nullable: true),
                    MeasuredValue = table.Column<string>(nullable: true),
                    Unit = table.Column<string>(nullable: true),
                    TestConclusion = table.Column<string>(nullable: true),
                    Operator = table.Column<string>(nullable: true),
                    OperationDate = table.Column<DateTime>(nullable: true),
                    MutualInspector = table.Column<string>(nullable: true),
                    MutualInspectionDate = table.Column<DateTime>(nullable: true),
                    Inspector = table.Column<string>(nullable: true),
                    InspectDate = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DingLiangExaminationFormEntity", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "DingXingExaminationFormEntity",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    FormInfoId = table.Column<Guid>(nullable: false),
                    OrderNo = table.Column<int>(nullable: false),
                    Oid = table.Column<string>(nullable: true),
                    PartDrawNo = table.Column<string>(nullable: true),
                    PartName = table.Column<string>(nullable: true),
                    ParamCode = table.Column<string>(nullable: true),
                    ProductNumber = table.Column<string>(nullable: true),
                    InspectionItems = table.Column<string>(nullable: true),
                    InspectionItemsNum = table.Column<string>(nullable: true),
                    TestConclusion = table.Column<string>(nullable: true),
                    Operator = table.Column<string>(nullable: true),
                    OperationDate = table.Column<DateTime>(nullable: true),
                    MutualInspector = table.Column<string>(nullable: true),
                    MutualInspectionDate = table.Column<DateTime>(nullable: true),
                    Inspector = table.Column<string>(nullable: true),
                    InspectDate = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DingXingExaminationFormEntity", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ElectricalConnectorFormEntity",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    FormInfoId = table.Column<Guid>(nullable: false),
                    OrderNo = table.Column<int>(nullable: false),
                    Oid = table.Column<string>(nullable: true),
                    PartDrawNo = table.Column<string>(nullable: true),
                    PartName = table.Column<string>(nullable: true),
                    ParamCode = table.Column<string>(nullable: true),
                    ProductNumber = table.Column<string>(nullable: true),
                    InspectionItems = table.Column<string>(nullable: true),
                    InspectionItemsNum = table.Column<string>(nullable: true),
                    ElectConn = table.Column<string>(nullable: true),
                    ElectConnModel = table.Column<string>(nullable: true),
                    MediaRecordingTime = table.Column<DateTime>(nullable: true),
                    MediaFileName = table.Column<string>(nullable: true),
                    TestConclusion = table.Column<string>(nullable: true),
                    Notekeeper = table.Column<string>(nullable: true),
                    RecordDate = table.Column<DateTime>(nullable: true),
                    Confirmer = table.Column<string>(nullable: true),
                    ConfirmDate = table.Column<DateTime>(nullable: true),
                    Inspector = table.Column<string>(nullable: true),
                    InspectDate = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ElectricalConnectorFormEntity", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "FormInfo",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    InstructionEntityId = table.Column<Guid>(nullable: false),
                    FormName = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FormInfo", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MaterialObjectFormEntity",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    FormInfoId = table.Column<Guid>(nullable: false),
                    OrderNo = table.Column<int>(nullable: false),
                    Oid = table.Column<string>(nullable: true),
                    PartDrawNo = table.Column<string>(nullable: true),
                    PartName = table.Column<string>(nullable: true),
                    ParamCode = table.Column<string>(nullable: true),
                    ProductNumber = table.Column<string>(nullable: true),
                    BatchCode = table.Column<string>(nullable: true),
                    ProofCode = table.Column<string>(nullable: true),
                    QualifiedCode = table.Column<string>(nullable: true),
                    InspectorTime = table.Column<string>(nullable: true),
                    BestowalTime = table.Column<string>(nullable: true),
                    Remark = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MaterialObjectFormEntity", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MomentRationExaminationFormEntity",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    FormInfoId = table.Column<Guid>(nullable: false),
                    OrderNo = table.Column<int>(nullable: false),
                    Oid = table.Column<string>(nullable: true),
                    PartDrawNo = table.Column<string>(nullable: true),
                    PartName = table.Column<string>(nullable: true),
                    ParamCode = table.Column<string>(nullable: true),
                    ProductNumber = table.Column<string>(nullable: true),
                    InspectionItems = table.Column<string>(nullable: true),
                    InspectionItemsNum = table.Column<string>(nullable: true),
                    DesignRequireValue = table.Column<string>(nullable: true),
                    UpperDeviation = table.Column<string>(nullable: true),
                    LowerDeviation = table.Column<string>(nullable: true),
                    Unit = table.Column<string>(nullable: true),
                    MeasuredValue = table.Column<string>(nullable: true),
                    ToolModel = table.Column<string>(nullable: true),
                    ToolNumber = table.Column<string>(nullable: true),
                    Operator = table.Column<string>(nullable: true),
                    OperationDate = table.Column<DateTime>(nullable: true),
                    MutualInspector = table.Column<string>(nullable: true),
                    MutualInspectionDate = table.Column<DateTime>(nullable: true),
                    Inspector = table.Column<string>(nullable: true),
                    InspectDate = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MomentRationExaminationFormEntity", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MultiMediaExaminationFormEntity",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    FormInfoId = table.Column<Guid>(nullable: false),
                    OrderNo = table.Column<int>(nullable: false),
                    Oid = table.Column<string>(nullable: true),
                    PartDrawNo = table.Column<string>(nullable: true),
                    PartName = table.Column<string>(nullable: true),
                    ParamCode = table.Column<string>(nullable: true),
                    ProductNumber = table.Column<string>(nullable: true),
                    InspectionItems = table.Column<string>(nullable: true),
                    InspectionItemsNum = table.Column<string>(nullable: true),
                    MediaRecordingTime = table.Column<DateTime>(nullable: true),
                    MediaFileName = table.Column<string>(nullable: true),
                    TestConclusion = table.Column<string>(nullable: true),
                    Operator = table.Column<string>(nullable: true),
                    OperationDate = table.Column<DateTime>(nullable: true),
                    Confirmer = table.Column<string>(nullable: true),
                    ConfirmDate = table.Column<DateTime>(nullable: true),
                    MutualInspector = table.Column<string>(nullable: true),
                    MutualInspectionDate = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MultiMediaExaminationFormEntity", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TestRationExaminationFormEntity",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    FormInfoId = table.Column<Guid>(nullable: false),
                    OrderNo = table.Column<int>(nullable: false),
                    Oid = table.Column<string>(nullable: true),
                    PartDrawNo = table.Column<string>(nullable: true),
                    PartName = table.Column<string>(nullable: true),
                    ParamCode = table.Column<string>(nullable: true),
                    ProductNumber = table.Column<string>(nullable: true),
                    InspectionItems = table.Column<string>(nullable: true),
                    InspectionItemsNum = table.Column<string>(nullable: true),
                    Cable = table.Column<string>(nullable: true),
                    ElectConn = table.Column<string>(nullable: true),
                    TestContent = table.Column<string>(nullable: true),
                    TestTool = table.Column<string>(nullable: true),
                    TestRequireResult = table.Column<string>(nullable: true),
                    UpperDeviation = table.Column<string>(nullable: true),
                    LowerDeviation = table.Column<string>(nullable: true),
                    Unit = table.Column<string>(nullable: true),
                    MeasuredValue = table.Column<string>(nullable: true),
                    Operator = table.Column<string>(nullable: true),
                    OperationDate = table.Column<DateTime>(nullable: true),
                    MutualInspector = table.Column<string>(nullable: true),
                    MutualInspectionDate = table.Column<DateTime>(nullable: true),
                    Inspector = table.Column<string>(nullable: true),
                    InspectDate = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TestRationExaminationFormEntity", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "DingLiangAndMultiMediaExaminationFormEntity");

            migrationBuilder.DropTable(
                name: "DingLiangExaminationFormEntity");

            migrationBuilder.DropTable(
                name: "DingXingExaminationFormEntity");

            migrationBuilder.DropTable(
                name: "ElectricalConnectorFormEntity");

            migrationBuilder.DropTable(
                name: "FormInfo");

            migrationBuilder.DropTable(
                name: "MaterialObjectFormEntity");

            migrationBuilder.DropTable(
                name: "MomentRationExaminationFormEntity");

            migrationBuilder.DropTable(
                name: "MultiMediaExaminationFormEntity");

            migrationBuilder.DropTable(
                name: "TestRationExaminationFormEntity");

            migrationBuilder.DropColumn(
                name: "TestProjectNum",
                table: "FormRelationEntities");

            migrationBuilder.DropColumn(
                name: "InstructionEntityId",
                table: "FormInstructionRelations");

            migrationBuilder.DropColumn(
                name: "RProcessesEntityId",
                table: "FormInstructionRelations");

            migrationBuilder.DropColumn(
                name: "RProcessesEntityName",
                table: "FormInstructionRelations");

            migrationBuilder.DropColumn(
                name: "RTechniqueEntityId",
                table: "FormInstructionRelations");

            migrationBuilder.DropColumn(
                name: "RTechniqueName",
                table: "FormInstructionRelations");

            migrationBuilder.DropColumn(
                name: "RTechniqueNum",
                table: "FormInstructionRelations");

            migrationBuilder.DropColumn(
                name: "RWorkStepEntityId",
                table: "FormInstructionRelations");

            migrationBuilder.DropColumn(
                name: "RWorkStepEntityName",
                table: "FormInstructionRelations");

            migrationBuilder.DropColumn(
                name: "ColTitle",
                table: "FormColRelationEntities");

            migrationBuilder.DropColumn(
                name: "TechniqueFormColTitle",
                table: "FormColRelationEntities");

            migrationBuilder.RenameColumn(
                name: "OriginalId",
                table: "InstructionEntities",
                newName: "OId");
        }
    }
}
